package com.king.springframework.util;

public class ClassUtil {
    public static ClassLoader getDefaultClassLoader(){
        ClassLoader classLoader = null;
        Thread.currentThread().getContextClassLoader();
        if(classLoader == null){
            classLoader = ClassUtil.class.getClassLoader();
        }
        return classLoader;
    }


    /**
     * 判断一个类是否是CGLIB生成的代理类
     * @param clazz
     * @return
     */
    public static boolean isCglibProxyClass(Class<?> clazz){
        return (clazz != null && isCglibProxyClassName(clazz.getName()));
    }
    public static boolean isCglibProxyClassName(String className){
        return (className != null && className.contains("$$"));
    }
}
